package main.剑指OfferⅠ;

public class Day3 {
    public static void main(String[] args) {
        System.out.println("剑指Offer05.替换空格");
        System.out.println("剑指Offer58-Ⅱ.左旋转字符串");
    }
}

class Offer05{
    public String replaceSpace(String s) {
        StringBuffer result=new StringBuffer();
        char[] str=s.toCharArray();
        for (char c:str){
            if (c!=' ') result.append(c);
            else result.append("%20");
        }
        return result.toString();
    }
}

class Offer58_Ⅱ{
    public String reverseLeftWords(String s, int n) {
        StringBuffer result=new StringBuffer();
        String str1=s.substring(0,n),str2=s.substring(n,s.length());//移动的串及剩余的串
        result.append(str2);
        result.append(str1);
        return result.toString();
    }
}